<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="bannerImg">
      <div class="banner-info">
        <p class="banner-title">{{this.sightName}}</p>
        <div class="banner-number"><span class="iconfont banner-icon">&#xeef8;</span>{{this.galleryImg.length}}</div>
      </div>
    </div>
    <fade-animation>
      <common-gallery
        :images="galleryImg"
        v-show="showGallery"
        @close="handleGalleryClose"
      ></common-gallery>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallery from '../../../commonComponents/gallary/gallery'
import FadeAnimation from '../../../commonComponents/fadeAnimation/fadeAnimation'
export default {
  name: 'DetailBanner',
  components: {
    CommonGallery,
    FadeAnimation
  },
  props: {
    sightName: String,
    bannerImg: String,
    galleryImg: Array
  },
  methods: {
    handleBannerClick () {
      this.showGallery = true
    },
    handleGalleryClose () {
      this.showGallery = false
    }
  },
  data () {
    return {
      showGallery: false
    }
  }
}
</script>

<style scoped lang="stylus">
  .banner
    overflow hidden
    padding-bottom 55%
    height 0
    position relative
    .banner-img
      width 100%
    .banner-info
      background-image linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,.8))
      display flex
      position absolute
      right 0
      left 0
      bottom 0
      line-height .6rem
      color #ffffff
      .banner-title
        flex 1
        font-size .32rem
        padding .1rem
        font-family "Adobe 黑体 Std R"
        font-weight 800
      .banner-number
        margin-top .2rem
        margin-right .14rem
        padding 0 .4rem
        line-height .4rem
        height .32rem
        font-size .24rem
        border-radius .2rem
        background-color rgba(0,0,0,.8)
        .banner-icon
          font-size .24rem
</style>
